<%@ page language="java" pageEncoding="UTF-8"%>
<%@ include file="/common/taglibs.jsp" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta http-equiv="x-ua-compatible" content="ie=7" />
<title>美瀛商旅-员工中心</title>
    <script type="text/javascript">
	$(function() {
		applyDate("datepicker1");
		applyDate("datepicker");

	});

	</script>
<script language="javascript">
function tabs(n)
{
var len = 4;
for (var i = 1; i <= len; i++)
{
document.getElementById('tab_a' + i).style.display = (i == n) ? 'block' : 'none';
document.getElementById('_' + i).style.display = (i == n) ? 'inline' : 'none';
}
}
function cl(n)
{
var len = 4;
for (var i = 1; i <= len; i++)
{
document.getElementById('tab_a' + i).style.display = (i == n) ? 'none' : 'none';
document.getElementById('_' + i).style.display = (i == n) ? 'none' : 'none';
}
}
function czopen(){   
            document.getElementById("check_see").style.display="block" ;}	
function czclose(){   
            document.getElementById("check_see").style.display="none" ;}

function splitOrder(orderId){

	urlDialog=__ctxPath+"/admin/order/bOrders.do?cmd=splitOrder&decorator=blank&orderId="+orderId;
	createOverlayDlg("sendMsg",{
	width:620,
	height:200,
	bgiframe: true,
	buttons:{
		"确定":function (){	
			var passengerIds="";
			var passengerLength=$("input[name=passengerId]").length;
			var checkLength=$("input[name=passengerId]:checked").length;
			var orderId=$("#orderId").val();
			$("input[name=passengerId]:checked").each(function(i){
				passengerIds+=$(this).val()+",";
			}); 
			 if(passengerIds==""){
				alert('请选择要分单的旅客');
				return;
			}
			if(passengerLength==checkLength){
				alert('拆分订单不能全选');
				return;
			} 
		 $.ajax({
			 type: "post",
			  url:__ctxPath+"/admin/order/bOrders.do?cmd=doSplitOrder",
			  data:{passengerIds:passengerIds,orderId:orderId},
			  async:false,
			  success: function(msg){
				  if(msg=="true"){
					  alert('订单拆分成功');
					  $("#sendMsg").dialog("close");
						location.reload();
				  }
				  if(msg=="false"){
					  alert('订单拆分失败');
				  }		
			  }
		  }) 
		},
		"取 消":function (){$(this).dialog("close");}
		},
		url:urlDialog
});

}
</script>

</head>

<body>
<!--内容-->
    <ul>
          <li class="titleonly">
          <img src="${ctxPath}/css/style/base/image/dot.gif" width="15" height="16" class="dot" />&gt;&gt;国内待出票订单
        </li>
        </ul>
        <ul>
        <form  action="bOrders.do" method="Post">
        <table width="600" border="0" cellspacing="0" cellpadding="0" class="dd">
  <tr>
    <td>开始时间：</td>
    <td><input name="Q_createTime_D_GT" value="${param['Q_createTime_D_GT']}" type="text" class="inputbox120" id="datepicker1" /></td>
    <td>&nbsp;&nbsp;&nbsp;&nbsp;</td>
    <td>结束时间：</td>
    <td><input name="Q_createTime_D_LT" value="${param['Q_createTime_D_LT']}" type="text" class="inputbox120" id="datepicker" /></td>
  </tr>
  <tr>
    <td>乘机人姓名：</td>
    <td><input name="Q_passengers.name_S_EQ" value="${param['Q_passengers.name_S_EQ']}" type="text" class="inputbox120" /></td>
    <td>&nbsp;&nbsp;</td>
    <td>联系人手机：</td>
    <td><input name="Q_contactMob_S_EQ" value="${param['Q_contactMob_S_EQ']}" type="text" class="inputbox120" /></td>
  </tr>
  <tr>
    <td>订单号：</td>
    <td><input name="Q_orderNo_S_EQ" value="${param['Q_orderNo_S_EQ']}" type="text" class="inputbox120" /></td>
    <td>&nbsp;&nbsp;</td>
    <td>订单状态：</td>
    <td>
    <select name="Q_status_L_EQ" class="inputbox130">
      <option value="">全部</option>
      <option value="9" <c:if test="${param['orderStatus']==9 || param['Q_status_L_EQ']==9}">selected="selected"</c:if>>未出票申请退款</option>
      <option value="6" <c:if test="${param['orderStatus']==6 || param['Q_status_L_EQ']==6}">selected="selected"</c:if>>订座成功等待价格确认</option>
      <option value="7" <c:if test="${param['orderStatus']==7 || param['Q_status_L_EQ']==7}">selected="selected"</c:if>>等待座位确认</option>
      <option value="0" <c:if test="${param['orderStatus']==0 || param['Q_status_L_EQ']==0}">selected="selected"</c:if>>订座成功等待支付</option>
      <option value="12" <c:if test="${param['orderStatus']==12 || param['Q_status_L_EQ']==12}">selected="selected"</c:if>>订单取消</option>
      <option value="1" <c:if test="${param['orderStatus']==1 || param['Q_status_L_EQ']==1}">selected="selected"</c:if>>支付成功等待出票</option>
      <option value="5" <c:if test="${param['orderStatus']==5 || param['Q_status_L_EQ']==5}">selected="selected"</c:if>>出票中</option>
      <option value="2" <c:if test="${param['orderStatus']==2 || param['Q_status_L_EQ']==2}">selected="selected"</c:if>>出票完成</option>
      <option value="40" <c:if test="${param['orderStatus']==40 || param['Q_status_L_EQ']==40}">selected="selected"</c:if>>改签申请中</option>
      <option value="42" <c:if test="${param['orderStatus']==42 || param['Q_status_L_EQ']==42}">selected="selected"</c:if>>改签完成</option>
      <option value="8" <c:if test="${param['orderStatus']==8 || param['Q_status_L_EQ']==8}">selected="selected"</c:if>>退票申请中</option>
      <option value="31" <c:if test="${param['orderStatus']==31 || param['Q_status_L_EQ']==31}">selected="selected"</c:if>>退票完成等待退款</option>
      <option value="39" <c:if test="${param['orderStatus']==39 || param['Q_status_L_EQ']==39}">selected="selected"</c:if>>退款完成</option>
      <option value="50" <c:if test="${param['orderStatus']==50 || param['Q_status_L_EQ']==50}">selected="selected"</c:if>>等待邮寄</option>
      </select>
    </td>
  </tr>
  <tr>
    <td>票号：</td>
    <td><input name="Q_passengers.eticketNum_S_EQ" value="${param['Q_passengers.eticketNum_S_EQ']}" type="text" class="inputbox120" /></td>
    <td>&nbsp;&nbsp;</td>
    <td>PNR：</td>
    <td><input name="Q_pnr_S_EQ" value="${param['Q_pnr_S_EQ']}" type="text" class="inputbox120" /></td>
  </tr>
  <tr>
    <td>航程类型：</td>
    <td><input name="flightType" type="radio" value="1" checked="checked"/>单程<input name="flightType" type="radio" value="2" />往返</td>
    <td>&nbsp;&nbsp;</td>
    <td>特殊查询：</td>
    <td><select class="inputbox130">
      <option value="1">全部</option>
      <option value="3">多于3人订单</option>
    </select>
    </td>
  </tr>
  <tr>
    <td colspan="5" style="text-align:center"><input name="Submit" type="submit" class="inputsubmit" value="查询" />&nbsp;&nbsp;   
      <input name="Submit2" type="reset"  class="inputsubmit" value="重置" /></td>
     </tr>
</table>
</form>
 </ul>

	<ul><li class="titleonly"><img src="${ctxPath}/css/style/base/image/dot.gif" width="15" height="16" class="dot" />&gt;&gt;机票预订记录</li></ul>
	<ul>
	  <li>
	  
	   		<c:set var="checkAll">
	  			<input type="checkbox" name="ckAll" onclick="checkAll(this,'id');"/>
	  		</c:set>
		    	<display:table name="bOrders" sort="external" pagesize="${bOrders.objectsPerPage}"
			    	cellpadding="0" cellspacing="0" style="width:100%" export="false" 
			    	id="bOrderItem" partialList="true" size="${bOrders.fullListSize}" requestURI="bOrders.do">
		<%-- 	    	<display:column title="${checkAll}" media="html" style="width:8px;align:center">
				  		<input type="checkbox" name="id" value="${bOrderItem.id}">
				  	</display:column> --%>
				<display:column property="orderNo" titleKey="bOrder.orderNo" sortName="orderNo" sortable="true" maxLength="4"  class="tableinfo center"/> 
				<display:column  titleKey="bOrder.flightType" sortName="flightType" sortable="true" class="tableinfo center"> 
					 <fmt:message key="bOrder.flightType${bOrderItem.flightType}"></fmt:message>
				</display:column>
				<display:column titleKey="bOrder.createTime" sortName="createTime" sortable="true" class="tableinfo center">
					<fmt:formatDate value="${bOrderItem.createTime}" pattern="yyyy-MM-dd"/><br/>
					<fmt:formatDate value="${bOrderItem.createTime}" pattern="HH:mm:ss"/>
				</display:column>  
				<display:column titleKey="起飞-到达"  sortable="true"  class="tableinfo center">
					<c:if test="${not empty bOrderItem.flights}">
						<c:forEach var="flight" items="${bOrderItem.flights}" end="0">
							${flight.depTime}&nbsp;${flight.dep}<br/>
							${flight.arrTime}&nbsp;${flight.arr}
						</c:forEach>
					</c:if>
				</display:column>  
				<display:column titleKey="航班日期</br>航班号"  sortable="true"  class="tableinfo center">
					<c:forEach var="flight" items="${bOrderItem.flights}" end="0">
							${flight.depDay}<br/>
							${flight.code}
						</c:forEach>
				</display:column>
				<display:column titleKey="PNR"   sortable="true"  class="tableinfo center">
					${bOrderItem.pnr}<br/>
					${bOrderItem.cpnr}
				</display:column>  
				<display:column titleKey="人数"  sortable="true"  class="tableinfo center">
					${fn:length(bOrderItem.passengers)}
				</display:column>
				<display:column titleKey="订单总价"  sortable="true"  property="allPrice" sortName="allPrice" class="tableinfo center">
				</display:column> 
				<display:column titleKey="订单状态"  sortable="true"  class="tableinfo center">
					 <fmt:message key="bOrder.status${bOrderItem.status}"></fmt:message>
				</display:column> 
				<display:column titleKey="政策ID"  sortable="true" class="tableinfo center">
					<c:if test="${not empty bOrderItem.policy }">
						${bOrderItem.policy.policyId}
					</c:if>	
					<c:if test="${empty bOrderItem.policy }">
						&nbsp;
					</c:if>
				</display:column>  				
				<display:column titleKey="操作" class="tableinfo center">
						<!--  <a href="bOrders.do?cmd=splitOrderObj&id=${bOrderItem.id}" class="update">拆分</a>-->
						<a href="bOrders.do?cmd=viewDetail&id=${bOrderItem.id}&status=" ><img src="${ctxPath}/css/style/base/image/open.gif" width="10" height="10" class="amen"/>查看</a>
						<c:if test="${bOrderItem.status==40||bOrderItem.status==7||bOrderItem.status==6||bOrderItem.status==7
						||bOrderItem.status==0||bOrderItem.status==1||bOrderItem.status==2}">
							<a href="bOrders.do?cmd=updateBorder&id=${bOrderItem.id}" ><img src="${ctxPath}/css/style/base/image/open.gif" width="10" height="10" class="amen"/>修改</a>
						</c:if>
						<%-- <c:if test="${bOrderItem.status==0}">
							<a href="bOrders.do?cmd=viewDetail&id=${bOrderItem.id}&status=${bOrderItem.status}" ><img src="${ctxPath}/css/style/base/image/open.gif" width="10" height="10" class="amen"/>支付确认</a>
						</c:if> --%>
						<c:if test="${bOrderItem.status==50}">
							<a href="transForm.do?id=${bOrderItem.id}" ><img src="${ctxPath}/css/style/base/image/open.gif" width="10" height="10" class="amen"/>配送</a>
						</c:if>
						<c:if test="${bOrderItem.status==8 || bOrderItem.status==9}">
							<a href="bOrders.do?cmd=changeReturn&id=${bOrderItem.id}" ><img src="${ctxPath}/css/style/base/image/open.gif" width="10" height="10" class="amen"/>退票</a>
						</c:if>
						<c:if test="${bOrderItem.status==40||bOrderItem.status==31}">
							<a href="bOrders.do?cmd=goReturn&id=${bOrderItem.id}" ><img src="${ctxPath}/css/style/base/image/open.gif" width="10" height="10" class="amen"/>退款</a>
						</c:if>
<%-- <a href="${ctxPath}/front/index.do?cmd=toUpdate&id=${bOrderItem.id}&actionType=8" style="line-height:18px;">退票</a></br>
<a href="${ctxPath}/front/index.do?cmd=toUpdate&id=${bOrderItem.id}&actionType=40" style="line-height:18px; ">改签</a></br> --%>
						
						<%-- <a href="bOrders.do?cmd=updateBorder&id=${bOrderItem.id}" ><img src="${ctxPath}/css/style/base/image/open.gif" width="10" height="10" class="amen"/>修改</a>
					--%>	
						<c:if test="${bOrderItem.status==2 && fn:length(bOrderItem.passengers)>1}">
						<a href="javascript:void(0);" class="delete" onclick="splitOrder(${bOrderItem.id})">拆分</a> 
						</c:if>
				</display:column>   
				 </display:table>	
	  </li>
	</ul>
</body>
</html>